﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using Wix.Aura.Common.CustomTypes;

namespace Wix.Aura.Common {
	public class Class : IXmlSerializable {

		private Class() { }

		public Class(Guid id) {
			Id = id;
			FileTypeMask = new List<FileTypeMask>();
			Interface = new List<Interface>();
			ProgId = new List<ProgId>();
		}

		public Guid Id { get; set; }
		public YesNoType Advertise { get; set; }
		public Guid? AppId { get; set; }
		public string Argument { get; set; }
		public Context? Context { get; set; }
		public YesNoType Control { get; set; }
		public string Description { get; set; }
		public string ForeignServer { get; set; }
		public string Handler { get; set; }
		public string Icon { get; set; }
		public int? IconIndex { get; set; }
		public YesNoType Insertable { get; set; }
		public YesNoType Programmable { get; set; }
		public YesNoType RelativePath { get; set; }
		public YesNoType SafeForInitializing { get; set; }
		public YesNoType SafeForScripting { get; set; }
		public string Server { get; set; }
		public YesNoType ShortPath { get; set; }
		public ThreadingModel? ThreadingModel { get; set; }
		public string Version { get; set; }

		public ICollection<FileTypeMask> FileTypeMask { get; set; }
		public ICollection<Interface> Interface { get; set; }
		public ICollection<ProgId> ProgId { get; set; }

		public System.Xml.Schema.XmlSchema GetSchema() {
			throw new NotImplementedException();
		}

		public void ReadXml(System.Xml.XmlReader reader) {
			throw new NotImplementedException();
		}

		public void WriteXml(System.Xml.XmlWriter writer) {
			writer.WriteStartElement("Class");
			writer.WriteAttribute("Id", Id);
			writer.WriteAttribute("Advertise", Advertise);
			writer.WriteAttribute("AppId", AppId);
			writer.WriteAttribute("Argument", Argument);
			writer.WriteAttribute("Context", Context);
			writer.WriteAttribute("Control", Control);
			writer.WriteAttribute("Description", Description);
			writer.WriteAttribute("ForeignServer", ForeignServer);
			writer.WriteAttribute("Handler", Handler);
			writer.WriteAttribute("Icon", Icon);
			writer.WriteAttribute("IconIndex", IconIndex);
			writer.WriteAttribute("Insertable", Insertable);
			writer.WriteAttribute("Programmable", Programmable);
			writer.WriteAttribute("RelativePath", RelativePath);
			writer.WriteAttribute("SafeForInitializing", SafeForInitializing);
			writer.WriteAttribute("SafeForScripting", SafeForScripting);
			writer.WriteAttribute("Server", Server);
			writer.WriteAttribute("ShortPath", ShortPath);
			writer.WriteAttribute("ThreadingModel", ThreadingModel);
			writer.WriteAttribute("Version", Version);
			writer.WriteElements(FileTypeMask);
			writer.WriteElements(Interface);
			writer.WriteElements(ProgId);
			writer.WriteEndElement();
		}
	}
}
